import React, { PureComponent, createRef } from "react";

export class App extends PureComponent {
  constructor() {
    super()

    this.state = {
      intro: '介绍'
    }
    this.introRef = createRef()
  }
  getIntro() {
    console.log(this.introRef.current.value);
  }

  render() {
    const { intro } = this.state
    return (
      <div>
        {/* 
          非受控组件
          通过defaultValue、defaultChecked来设置默认值
        */}
        <input 
          type="textarea" 
          defaultValue={intro} 
          ref={this.introRef}
        />
        <button onClick={() => this.getIntro()}>获取介绍信息</button>
      </div>
    )
  }
}

export default App;
